using System;
using System.Diagnostics;
using System.Collections.Generic;

using Weazel.Gezel.Model;
using Weazel.Gezel.Model.Errors;
using Weazel.Gezel.Parser;

using GezelModel = Weazel.Gezel.Model.Model;

namespace Weazel.Gezel.ConversionsTest
{
  /// <summary>
  /// Helps building and verifying gezel models from strings
  /// </summary>
  public class GezelModelBuilder
  {
    public static GezelModel BuildModel(string description)
    {
      List<ParseError> parseErrors = new List<ParseError>();
      GezelModel model = ParseModel.Parse(ref parseErrors, description);

      Trace.Assert(parseErrors.Count == 0, "description could not be parsed", description);

      List<VerificationError> verificationErrors = model.Verify();
      Trace.Assert(verificationErrors.Count == 0, "description could not be verified", description);

      return model;
    }
  }
}
